package com.wwdx.service.impl;

import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
import com.wwdx.wechat.config.BaseWxPayConfig;

import javax.annotation.PostConstruct;

/**
 * @author liguoliang
 */
public abstract class BaseWxPayService extends WxPayServiceImpl{

    /**
     * 微信公众号支付配置类
     * @return BaseWxPayConfig 子类
     */
    protected abstract BaseWxPayConfig getServerConfig();

    @PostConstruct
    public void init() {
        final WxPayConfig config = new WxPayConfig();
        config.setAppId(this.getServerConfig().getAppId());
        config.setMchId(this.getServerConfig().getMchId());
        config.setMchKey(this.getServerConfig().getMchKey());
        super.setConfig(config);
    }
}
